Skip to content

Conversation

@Paperomo
Copy link
Contributor

@Paperomo Paperomo commented Oct 4, 2025

the .cstr() function on String appears to be removed. code does not compile when used in a C++ Module. in 4.5

the .cstr() function on String appears to be removed.
code does not compile when used in a C++ Module. in 4.5
Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. The modern version of c_str() is .utf8().get_data(), but I don't this is important in the context of format strings.

Added comments explaining conversion of String to const char*.
@Paperomo
Copy link
Contributor Author

Paperomo commented Nov 3, 2025

Updated with @Calinou 's suggestion

// You may need to do this if passing the result as an argument
// to a method that expects a `const char *` instead of a String.
vformat("My name is %s.", "Godette").c_str();
vformat("My name is %s.", "Godette")..utf8().get_data();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vformat("My name is %s.", "Godette")..utf8().get_data();
vformat("My name is %s.", "Godette").utf8().get_data();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants